home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- #
- # Install Script for UNIX Acrobat Exchange and Reader v. 5.0.6
- #
- # Copyright (c)1995-2002 Adobe Systems Incorporated
- # All Rights Reserved
- #
- ##########################################################################
-
- echoawk ()
- {
- echo $* | awk '{ printf "%s", $0 }'
- }
-
- echon ()
- {
- echo -n "$*"
- }
-
- echoc ()
- {
- echo "${*}\c"
- }
-
- ##########################################################################
-
- yesno()
- {
- msg="$1"
- def="$2"
- while true ; do
- echo " "
- $echonl "$msg"
- read answer
- if [ "$answer" ] ; then
- case "$answer" in
- y|Y|yes|YES)
- return 0
- ;;
- n|N|no|NO)
- return 1
- ;;
- *)
- echo " "
- echo "ERROR: Invalid response, expected \"yes\" or \"no\"."
- continue
- ;;
- esac
- else
- return $def
- fi
- done
- }
-
- TypeCheck()
- {
- h=`type $1 2> /dev/null`
- case " $h " in
- *' '/*/$1' '*)
- return 0
- ;;
- *)
- return 1
- ;;
- esac
- }
-
-
- OutputLicense ()
- {
- if [ -z "$1" ] ; then
- return
- fi
-
- if [ ! -f "$1" ] ; then
- echo " "
- echo "ERROR: Cannot find license file ... aborting"
- echo " "
- exit 1
- else
- LicenseFile="$1"
- fi
-
- TypeCheck $PAGER
- if [ $? -ne 0 ] || [ -z "$PAGER" ] ; then
- command=cat
- TypeCheck pg
- if [ $? -eq 0 ] ; then
- command=pg
- fi
- TypeCheck more
- if [ $? -eq 0 ] ; then
- command=more
- fi
- else
- command="$PAGER"
- fi
-
-
- echo " "
- $command "$LicenseFile"
-
- answer=
- while [ -z "$answer" ] ; do
- echo " "
- echo " "
- echo "To accept the terms and conditions of this agreement enter \"accept\"."
- echo "To decline the terms and conditions of this agreement enter \"decline\"."
- echo " "
- $echonl "Please type \"accept\" to accept the terms and conditions license agreement; Type \"decline\" to exit. "
- read answer
- ucanswer=`echo "${answer}" | tr '[a-z]' '[A-Z]'`
- case "$ucanswer" in
- ACCEPT)
- ;;
- DECLINE)
- echo " "
- echo "License not accepted ... aborting installation"
- echo " "
- exit 1
- ;;
- *)
- echo " "
- echo "ERROR: Invalid response, expected \"accept\" or \"decline\" ... try again"
- answer=
- ;;
- esac
- done
- }
-
- PrintRequiredFree()
- {
- total=0
- for i in $* ; do
- if [ "$i" -a -f "$i" ] ; then
- if [ `uname -s` = "Linux" ] ; then
- size=`ls -lLn "$i" | ( read perm links owner group size date ; echo $size )`
- else
- size=`ls -lLon "$i" | ( read perm links owner size date ; echo $size )`
- fi
- if [ "$size" ] ; then
- total=`expr $total + $size`
- fi
- fi
- done
-
- megs=`expr $total / 1048576 + 1`
-
- echo " "
- echo "This installation requires ${megs}MB of free disk space."
- }
-
- FilterPathName ()
- {
- newpathname="$1"
- case "$newpathname" in
- ~*)
- if [ -f /bin/csh -a -x /bin/csh ] ; then
- newpathname=`/bin/csh -c "echo $newpathname"`
- fi
- ;;
- ../*|./*)
- newpathname=`pwd`/"${newpathname}"
- ;;
- *)
- ;;
- esac
- eval newpathname=\"${newpathname}\"
- echo "${newpathname}"
- }
-
- ExtractFiles ()
- {
- ( cd "$1" ; tar xf "$2" )
- }
-
- InstallFiles ()
- {
- msg="$1"
- install="$2"
- shift
- shift
-
- echo " "
-
- for i in "$@" ; do
- if [ "$i" ] ; then
- if [ "$msg" ] ; then
- $echonl "$msg"
- msg=""
- fi
- ExtractFiles "$install" "$i"
- fi
- done
-
- if [ -z "$msg" ] ; then
- echo "Done"
- fi
- }
-
- InstallBin()
- {
- topdir="$1"
- product="$2"
-
- for i in "$topdir"/bin/*.sh ; do
- if [ -f "$i" ] ; then
- filename="$topdir"/bin/`basename "$i" .sh`
-
- case "$product" in
- Reader)
- replacement="$topdir"/"$product"
- ;;
- *)
- echo "ERROR installing $filename, invalid product name"
- ;;
- esac
-
- ed -s "$i" <<__EOF__
- 1,\$s@REPLACE_ME@$replacement@
- w
- q
- __EOF__
- if [ $? != 0 ] ; then
- echo "ERROR installing $filename"
- continue
- fi
-
- chmod +x "$i"
- if [ $? != 0 ] ; then
- echo "ERROR installing $filename"
- continue
- fi
-
- rm -f "$filename"
- mv "$i" "$filename"
- if [ $? != 0 ] ; then
- echo "ERROR installing $filename"
- continue
- fi
-
- fi
- done
- }
-
- GetInstallDirectory ()
- {
- if [ -z "$1" ] ; then
- product=Acrobat
- else
- product="$1"
- fi
-
- var=$2
-
- case "$product" in
- Reader) productName="Acrobat Reader" ;;
- *) productName="Acrobat" ;;
- esac
-
- defdir="/usr/local/Acrobat5"
- case "$OSname" in
- SunOS)
- case "$OSrelease" in
- 4.1.3*|4.1.4*|4.1C) defdir="/usr/Acrobat5" ;;
- 5.*) defdir="/opt/Acrobat5" ;;
- esac
- ;;
- HP-UX)
- case "$OSrelease" in
- *.09.*) defdir="/usr/Acrobat5" ;;
- *.10.*) defdir="/opt/Acrobat5" ;;
- *) defdir="/opt/Acrobat5" ;;
- esac
- ;;
- AIX)
- defdir="/usr/lpp/Acrobat5"
- ;;
- esac
-
- while [ -z "$InstallDir" ] ; do
-
- InstallDir="$defdir"
-
- echo " "
- $echonl "Enter installation directory for Acrobat ${Version} [${InstallDir}] "
- read answer
- case "$answer" in
- "")
- ;;
- *)
- InstallDir="$answer"
- ;;
- esac
-
- InstallDir=`FilterPathName "$InstallDir"`
-
- if [ ! -d "$InstallDir" ] ; then
- echo " "
- echo "Directory \"$InstallDir\" does not exist."
- $echonl "Do you want to create it now? [y] "
- read answer
-
- if [ "$answer" ] ; then
- case "$answer" in
- y|Y)
- mkdir -p "$InstallDir"/"$product"
- ;;
- n|N)
- echo "Exit installation...\n"
- exit 0
- ;;
- esac
- else
- mkdir -p "$InstallDir"/"$product"
- fi
-
- if [ ! -d "$InstallDir" ] ; then
- echo " "
- echo "ERROR: Cannot make directory \"$InstallDir\"."
- InstallDir=""
- continue;
- fi
- fi
-
- if ( echo foo > "$InstallDir"/AcroWriteTest ) 2> /dev/null ; then
- rm -f "$InstallDir"/AcroWriteTest
- break
- else
- echo " "
- echo "ERROR: Cannot write to directory \"$InstallDir\"."
- InstallDir=""
- continue
- fi
- done
-
- eval $var=\"$InstallDir\"
- }
-
- InstallReader()
- {
- ReadConfig="$1"
- ReadPlatformTar="$2"
- SearchPlatformTar="$3"
- CustomPlatformTar="$4"
-
- OutputLicense "$ReadLicense"
- ReadLicense=""
-
- PrintRequiredFree "$ReadTar" "$SearchTar" "$CustomTar" \
- "$ReadPlatformTar" "$SearchPlatformTar" "$CustomPlatformTar"
-
- if [ -z "$ReadInstallDir" ] ; then
- GetInstallDirectory Reader ReadInstallDir
- fi
-
- InstallFiles "Installing platform independent files ... " \
- "$ReadInstallDir" "$ReadTar" "$SearchTar" "$CustomTar"
- InstallFiles "Installing platform dependent files ... " \
- "$ReadInstallDir" \
- "$ReadPlatformTar" "$SearchPlatformTar" "$CustomPlatformTar"
- InstallBin "$ReadInstallDir" Reader
-
- ReadTar=""
- SearchTar=""
- CustomTar=""
- }
-
- ##############################################################
-
- #
- # Initialization:
- #
-
- umask 022
-
- ScriptName=`basename $0`
- CurrentDirectory=`pwd`
- ScriptDirectory=`dirname $0`
- AcroSerNum=""
- AcroCompName=""
- case "${ScriptDirectory}" in
- /*) ;;
- .) ScriptDirectory="$CurrentDirectory" ;;
- *) ScriptDirectory="$CurrentDirectory"/"$ScriptDirectory" ;;
- esac
-
- TypeCheck uname
- if [ $? -eq 0 ] ; then
- OSname=`uname -s`
- if [ "$OSname" = "AIX" ] ; then
- OSrelease=`uname -a | ( read name host minor major foo ; echo $major.$minor )`
- else
- OSrelease=`uname -r`
- fi
- else
- OSname=unknown
- OSrelease=unknown
- fi
-
-
-
- if [ `echo "x\c"` = "x" ] ; then
- echonl=echoc
- else
- echonl=echon
- fi
-
- Version=5.0.5
-
- #
- # Get the filenames:
- #
-
- for i in ${ScriptDirectory}/* ${ScriptDirectory}/../COMMON/* ${ScriptDirectory}/../common/*; do
- if [ -f "$i" ] ; then
- case $i in
- */licread.txt*|*/LICREAD.TXT*)
- ReadLicense="$i"
- ;;
- */common.tar*|*/COMMON.TAR*)
- ReadTar="$i"
- ;;
- */search.tar*|*/SEARCH.TAR*)
- SearchTar="$i"
- ;;
- */custom.tar*|*/CUSTOM.TAR*)
- CustomTar="$i"
- ;;
- */solrdr.tar*|*/SOLRDR.TAR*)
- ReadSparcSolarisTar="$i"
- ;;
- */hpuxrdr.tar*|*/HPUXRDR.TAR*)
- ReadHppaHpuxTar="$i"
- ;;
- */aixrdr.tar*|*/AIXRDR.TAR*)
- ReadRS6000AIXTar="$i"
- ;;
- */linuxrdr.tar*|*/LINUXRDR.TAR*)
- ReadIntelLinuxTar="$i"
- ;;
- */ilinxc.tar*|*/ILINXC.TAR*)
- CustomIntelLinuxTar="$i"
- ;;
- esac
- fi
- done
-
-
- #
- # Validate the configurations:
- #
-
- NumConfigs=0
-
- if [ "$ReadTar" -a "$ReadLicense" ] ; then
- if [ "$ReadSparcSolarisTar" ] ; then
- NumConfigs=`expr $NumConfigs + 1`
- ReadSparcSolarisNum=$NumConfigs
- fi
- if [ "$ReadHppaHpuxTar" ] ; then
- NumConfigs=`expr $NumConfigs + 1`
- ReadHppaHpuxNum=$NumConfigs
- fi
- if [ "$ReadRS6000AIXTar" ] ; then
- NumConfigs=`expr $NumConfigs + 1`
- ReadRS6000AIXNum=$NumConfigs
- fi
- if [ "$ReadIntelLinuxTar" ] ; then
- NumConfigs=`expr $NumConfigs + 1`
- ReadIntelLinuxNum=$NumConfigs
- fi
- fi
- if [ "$NumConfigs" = "0" ] ; then
- echo " "
- echo "ERROR: No configurations found ... aborting"
- echo " "
- exit 1
- elif [ "$NumConfigs" = "1" ] ; then
- SingleConfig=true
- fi
-
- NumConfigs=`expr $NumConfigs + 1`
- ExitNum=$NumConfigs
-
-
- #
- # Check if there is a configuration supported by this OS.
- #
-
- case "$OSname" in
- SunOS)
- case "$OSrelease" in
- 4.1.3*|4.1.4*|4.1C)
- ReadDefaultNum="$ReadSparcSunNum"
- DefaultName="SPARC/SunOS 4.1.3 and later"
- ;;
- 5.1|5.1.*|5.2|5.2.*)
- ;;
- 5.*)
- MachArch=`uname -p`
- case "$MachArch" in
- sparc)
- ReadDefaultNum="$ReadSparcSolarisNum"
- DefaultName="SPARC/Solaris 2.x"
- ;;
- esac
- ;;
- esac
- ;;
- HP-UX)
- case "$OSrelease" in
- *.09.*|*.10.*|*.11.*)
- ReadDefaultNum="$ReadHppaHpuxNum"
- DefaultName="HP-UX"
- ;;
- esac
- ;;
- AIX)
- case "$OSrelease" in
- 4.*|5.*)
- ReadDefaultNum="$ReadRS6000AIXNum"
- DefaultName="AIX"
- ;;
- esac
- ;;
- Linux)
- ReadDefaultNum="$ReadIntelLinuxNum"
- DefaultName="Intel/Linux"
- ;;
- esac
-
- if [ -z "$ReadDefaultNum" ] ; then
- echo ""
- echo "WARNING: The chosen configuration will not run on your current platform ($OSname/$OSrelease)."
- if yesno "Continue installation? [n] " 1 ; then
- :
- else
- exit 1
- fi
- fi
-
-
- #
- # If multiple confurations, get the default configuration
- #
-
- if [ -z "$SingleConfig" ] ; then
- if [ "$ReadDefaultNum" ] ; then
- if yesno "Install default configuration, Acrobat Reader ${Version} for $DefaultName? [y] " 0 ; then
- DefaultConfig="$ReadDefaultNum"
- fi
- fi
- fi
-
-
- #
- # If a single configuration available the loop will be executed once
- # otherwise it will ask for each configuration to install
- #
-
- while [ "$NumConfigs" -gt 1 ] ; do
-
- #
- # If multiple configuration ask for which to install
- #
-
- if [ "$SingleConfig" ] ; then
-
- ConfigNum=1
-
- elif [ "$DefaultConfig" ] ; then
-
- ConfigNum="$DefaultConfig"
-
- else
-
- #
- # Display multiple configurations
- #
-
- echo " "
- echo "The following configurations are available for installation:"
- echo " "
-
- if [ "$AcroSparcSolarisNum" ] ; then
- echo " ${AcroSparcSolarisNum}. Acrobat ${Version} for SPARC/Solaris 2.x"
- fi
- if [ "$AcroHppaHpuxNum" ] ; then
- echo " ${AcroHppaHpuxNum}. Acrobat ${Version} for HP-UX"
- fi
- if [ "$AcroRS6000AIXNum" ] ; then
- echo " ${AcroRS6000AIXNum}. Acrobat ${Version} for AIX"
- fi
- if [ "$AcroIntelLinuxNum" ] ; then
- echo " ${AcroIntelLinuxNum}. Acrobat ${Version} for Intel/Linux"
- fi
- if [ "$ReadSparcSolarisNum" ] ; then
- echo " ${ReadSparcSolarisNum}. Acrobat Reader ${Version} for SPARC/Solaris 2.x"
- fi
- if [ "$ReadHppaHpuxNum" ] ; then
- echo " ${ReadHppaHpuxNum}. Acrobat Reader ${Version} for HP-UX"
- fi
- if [ "$ReadRS6000AIXNum" ] ; then
- echo " ${ReadRS6000AIXNum}. Acrobat Reader ${Version} for AIX"
- fi
- if [ "$ReadIntelLinuxNum" ] ; then
- echo " ${ReadIntelLinuxNum}. Acrobat Reader ${Version} for Intel/Linux"
- fi
- if [ "$ExitNum" ] ; then
- echo " ${ExitNum}. Exit Acrobat installation"
- fi
-
- echo " "
- $echonl "Enter the configuration number to install: "
- read ConfigNum
-
- fi
-
-
- #
- # Install the configuration
- #
-
- if [ -z "$ConfigNum" ] ; then
-
- echo " "
- echo "ERROR: Invalid response ... try again"
- continue
- elif [ "$ConfigNum" = "$ReadSparcSolarisNum" ] ; then
-
- InstallReader sparcsolaris "$ReadSparcSolarisTar" \
- "$SearchSparcSolarisTar" "$CustomSparcSolarisTar"
- ReadSparcSolarisNum=""
- elif [ "$ConfigNum" = "$ReadHppaHpuxNum" ] ; then
-
- InstallReader hppahpux "$ReadHppaHpuxTar" \
- "$SearchHppaHpuxTar" "$CustomHppaHpuxTar"
- ReadHppaHpuxNum=""
- elif [ "$ConfigNum" = "$ReadRS6000AIXNum" ] ; then
-
- InstallReader rs6000aix "$ReadRS6000AIXTar" \
- "$SearchRS6000AIXTar" "$CustomRS6000AIXTar"
- ReadRS6000AIXNum=""
-
- elif [ "$ConfigNum" = "$ReadIntelLinuxNum" ] ; then
-
- InstallReader intellinux "$ReadIntelLinuxTar" \
- "$SearchIntelLinuxTar" "$CustomIntelLinuxTar"
- ReadIntelLinuxNum=""
-
- elif [ "$ConfigNum" = "$ExitNum" ] ; then
-
- break
-
- else
-
- echo " "
- echo "ERROR: Invalid response ... try again"
- continue
-
- fi
-
- if [ "$DefaultConfig" ] ; then
- break;
- fi
-
- if [ -z "$MultipleInstall" ] ; then
- break;
- fi
-
- NumConfigs=`expr $NumConfigs - 1`
-
- done
-
- echo " "
- exit 0
-